# -*- coding: utf-8 -*-
import socket
import json
serve_ip = '116.6.118.173' #'gastest.gree.com'
port = 7005


def sendMsg(phoneNum, msginfo):
    '''
    发送短信
    :param phoneNum: 手机号必须为字符串，或者字符串列表（群发）
    :param msginfo: 手机信息内容
    :return:
    '''
    if isinstance(phoneNum, str):
        phoneNum = [phoneNum]
    dc = {"msgClass": 0,
          "messageInfo": msginfo,
          "phoneList": phoneNum}
    jsoninfo = json.dumps(dc)
    print(jsoninfo)
    tcpsocket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    tcpsocket.connect((serve_ip, port))
    tcpsocket.send(jsoninfo.encode("utf-8"))


if __name__ == '__main__':
    sendMsg("15901114000", "手机接口测试，数字：12345，英文：english test,特殊符号：☔")
